package iedcyt.acute.utils.configuration;

import java.util.HashMap;
import java.util.List;

public class RefactorPIO {

	private static RefactorPIO _instance;
	
	private HashMap<String,String> _refactorPIO;
	
	public HashMap<String, String> get_refactorPIO() {
		return _refactorPIO;
	}

	public void set_refactorPIO(HashMap<String, String> _refactorPIO) {
		this._refactorPIO = _refactorPIO;
	}

	private RefactorPIO() {
		//Los PIOs a considerar iguales deben ir en parejas y separados por -
		//Ejemplo: H1%-H;H2%-H
		
		_refactorPIO = new HashMap<String, String>();
		
		List<String> list = Configuration.getInstance().getPropertyList("refactor_PIOs");
		
		for(String pair : list) {
			String[] splits = pair.split("-");
			
			if (splits.length == 2) {
				_refactorPIO.put(splits[0], splits[1]);
			}
		}
		
	}
	
	public static RefactorPIO getInstance() {
		if (_instance == null) _instance = new RefactorPIO();
		
		return _instance;
	}
	
}
